package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepModuleMapper;
import com.ruoyi.deeplearn.domain.DeepModule;
import com.ruoyi.deeplearn.service.IDeepModuleService;

/**
 * 模块Service业务层处理
 * 
 * @author 任伟伟
 * @date 2022-12-10
 */
@Service
public class DeepModuleServiceImpl implements IDeepModuleService 
{
    @Autowired
    private DeepModuleMapper deepModuleMapper;

    /**
     * 查询模块
     * 
     * @param moduleId 模块主键
     * @return 模块
     */
    @Override
    public DeepModule selectDeepModuleByModuleId(Long moduleId)
    {
        return deepModuleMapper.selectDeepModuleByModuleId(moduleId);
    }

    /**
     * 查询模块列表
     * 
     * @param deepModule 模块
     * @return 模块
     */
    @Override
    public List<DeepModule> selectDeepModuleList(DeepModule deepModule)
    {
        return deepModuleMapper.selectDeepModuleList(deepModule);
    }

    /**
     * 新增模块
     * 
     * @param deepModule 模块
     * @return 结果
     */
    @Override
    public int insertDeepModule(DeepModule deepModule)
    {
        deepModule.setModuleId(IdUtil.getSnowflakeNextId());
        deepModule.setCreateTime(DateUtils.getNowDate());
        return deepModuleMapper.insertDeepModule(deepModule);
    }

    /**
     * 修改模块
     * 
     * @param deepModule 模块
     * @return 结果
     */
    @Override
    public int updateDeepModule(DeepModule deepModule)
    {
        deepModule.setUpdateTime(DateUtils.getNowDate());
        return deepModuleMapper.updateDeepModule(deepModule);
    }

    /**
     * 批量删除模块
     * 
     * @param moduleIds 需要删除的模块主键
     * @return 结果
     */
    @Override
    public int deleteDeepModuleByModuleIds(Long[] moduleIds)
    {
        return deepModuleMapper.deleteDeepModuleByModuleIds(moduleIds);
    }

    /**
     * 删除模块信息
     * 
     * @param moduleId 模块主键
     * @return 结果
     */
    @Override
    public int deleteDeepModuleByModuleId(Long moduleId)
    {
        return deepModuleMapper.deleteDeepModuleByModuleId(moduleId);
    }
}
